package cn.micai.base.concurrent;

/**
 * 描述：
 * <p>
 *
 * @author: 赵新国
 * @date: 2018/7/2 9:38
 */
public class Widget {

    public synchronized void doSomething() {
        System.out.println("super doSomething");
    }

    public static class LoggingWidget extends Widget {
        @Override
        public synchronized void doSomething() {
            System.out.println(toString() + ": calling doSomething");
            super.doSomething();
        }
    }

    public static void main(String [] args) {
        LoggingWidget loggingWidget = new LoggingWidget();
        loggingWidget.doSomething();
        // 重进入锁帮助我们避免了死锁
    }
}
